#!/usr/bin/python
# -*- coding: utf-8 -*-

from datetime import datetime  
from datetime import date
import sys

classname = "Unknown"
if len(sys.argv) > 1:
    classname = sys.argv[1]
header_filename = "%s.h" % (classname, )
cpp_filename = "%s.cpp" % (classname, )
author = "lizk"
date = date(datetime.now().year,datetime.now().month,datetime.now().day)

def build_description(filename):
    description = \
"""\
/*
*****************************************************************************
* Copyright (C) 2005-%s ABC Inc. All rights reserved
* File          : %s
* Description   :  
* History       : 
* Creation, %s, %s, Create the file
******************************************************************************
*/
""" % (datetime.now().year, filename, date, author)
    return description

classdeclaration = """
#ifndef %s_H
#define %s_H

namespace WebCore {

class %s
{
public:

private:

}; // class %s

} // namespace WebCore

#endif // %s_H
""" % (classname, classname, classname, classname, classname)

def saveFile(filename, unicode_data):
    data = unicode_data.encode("utf-8")
    f = open(filename, "w")
    f.write(data)
    f.close()

header = ""
header += build_description(header_filename)
header += classdeclaration
saveFile(header_filename, header)
print "create header file: %s OK." % (header_filename,)

cpp_context = \
"""
#include "%s"

namespace WebCore {



} // namespace WebCore
""" % (header_filename,)

cpp = ""
cpp += build_description(cpp_filename)
cpp += cpp_context
saveFile(cpp_filename, cpp)
print "create cpp file: %s OK." % (cpp_filename,)
